--
-- PostgreSQL database dump
--

SET client_encoding = 'LATIN1';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;

--
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
--

COMMENT ON SCHEMA public IS 'Standard public schema';


--
-- Name: timelife; Type: SCHEMA; Schema: -; Owner: postgres
--

CREATE SCHEMA timelife;


ALTER SCHEMA timelife OWNER TO postgres;

--
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: postgres
--

CREATE PROCEDURAL LANGUAGE plpgsql;


SET search_path = timelife, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- Name: comments; Type: TABLE; Schema: timelife; Owner: postgres; Tablespace: 
--

CREATE TABLE comments (
    id integer NOT NULL,
    moment_id integer,
    title character varying(256)
);


ALTER TABLE timelife.comments OWNER TO postgres;

--
-- Name: comments_id_seq; Type: SEQUENCE; Schema: timelife; Owner: postgres
--

CREATE SEQUENCE comments_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE timelife.comments_id_seq OWNER TO postgres;

--
-- Name: comments_id_seq; Type: SEQUENCE OWNED BY; Schema: timelife; Owner: postgres
--

ALTER SEQUENCE comments_id_seq OWNED BY comments.id;


--
-- Name: comments_id_seq; Type: SEQUENCE SET; Schema: timelife; Owner: postgres
--

SELECT pg_catalog.setval('comments_id_seq', 1, false);


--
-- Name: files; Type: TABLE; Schema: timelife; Owner: postgres; Tablespace: 
--

CREATE TABLE files (
    id integer NOT NULL,
    name character varying(256),
    file character varying(256),
    size real,
    ext character varying(10),
    moment_id integer
);


ALTER TABLE timelife.files OWNER TO postgres;

--
-- Name: files_id_seq; Type: SEQUENCE; Schema: timelife; Owner: postgres
--

CREATE SEQUENCE files_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE timelife.files_id_seq OWNER TO postgres;

--
-- Name: files_id_seq; Type: SEQUENCE OWNED BY; Schema: timelife; Owner: postgres
--

ALTER SEQUENCE files_id_seq OWNED BY files.id;


--
-- Name: files_id_seq; Type: SEQUENCE SET; Schema: timelife; Owner: postgres
--

SELECT pg_catalog.setval('files_id_seq', 1, false);


--
-- Name: moments; Type: TABLE; Schema: timelife; Owner: postgres; Tablespace: 
--

CREATE TABLE moments (
    id integer NOT NULL,
    time_line_id integer,
    create_hour timestamp with time zone,
    title character varying(256),
    description text
);


ALTER TABLE timelife.moments OWNER TO postgres;

--
-- Name: moments_id_seq; Type: SEQUENCE; Schema: timelife; Owner: postgres
--

CREATE SEQUENCE moments_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE timelife.moments_id_seq OWNER TO postgres;

--
-- Name: moments_id_seq; Type: SEQUENCE OWNED BY; Schema: timelife; Owner: postgres
--

ALTER SEQUENCE moments_id_seq OWNED BY moments.id;


--
-- Name: moments_id_seq; Type: SEQUENCE SET; Schema: timelife; Owner: postgres
--

SELECT pg_catalog.setval('moments_id_seq', 1, false);


--
-- Name: photos; Type: TABLE; Schema: timelife; Owner: postgres; Tablespace: 
--

CREATE TABLE photos (
    id integer DEFAULT nextval('files_id_seq'::regclass) NOT NULL,
    name character varying(256),
    file character varying(256),
    size real,
    ext character varying(10),
    moment_id integer
);


ALTER TABLE timelife.photos OWNER TO postgres;

--
-- Name: times_lines; Type: TABLE; Schema: timelife; Owner: postgres; Tablespace: 
--

CREATE TABLE times_lines (
    id integer NOT NULL,
    user_id integer,
    create_date timestamp with time zone,
    num_photos integer
);


ALTER TABLE timelife.times_lines OWNER TO postgres;

--
-- Name: times_lines_id_seq; Type: SEQUENCE; Schema: timelife; Owner: postgres
--

CREATE SEQUENCE times_lines_id_seq
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE timelife.times_lines_id_seq OWNER TO postgres;

--
-- Name: times_lines_id_seq; Type: SEQUENCE OWNED BY; Schema: timelife; Owner: postgres
--

ALTER SEQUENCE times_lines_id_seq OWNED BY times_lines.id;


--
-- Name: times_lines_id_seq; Type: SEQUENCE SET; Schema: timelife; Owner: postgres
--

SELECT pg_catalog.setval('times_lines_id_seq', 1, true);


--
-- Name: time_lines; Type: TABLE; Schema: timelife; Owner: postgres; Tablespace: 
--

CREATE TABLE time_lines (
    id integer DEFAULT nextval('times_lines_id_seq'::regclass) NOT NULL,
    user_id integer,
    create_date timestamp with time zone,
    num_photos integer
);


ALTER TABLE timelife.time_lines OWNER TO postgres;

--
-- Name: users; Type: TABLE; Schema: timelife; Owner: postgres; Tablespace: 
--

CREATE TABLE users (
    id integer NOT NULL,
    name character varying(256),
    facebook_id bigint,
    about text,
    username character varying(50),
    "password" character varying(50)
);


ALTER TABLE timelife.users OWNER TO postgres;

--
-- Name: users_id_seq; Type: SEQUENCE; Schema: timelife; Owner: postgres
--

CREATE SEQUENCE users_id_seq
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;


ALTER TABLE timelife.users_id_seq OWNER TO postgres;

--
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: timelife; Owner: postgres
--

ALTER SEQUENCE users_id_seq OWNED BY users.id;


--
-- Name: users_id_seq; Type: SEQUENCE SET; Schema: timelife; Owner: postgres
--

SELECT pg_catalog.setval('users_id_seq', 23, true);


--
-- Name: id; Type: DEFAULT; Schema: timelife; Owner: postgres
--

ALTER TABLE comments ALTER COLUMN id SET DEFAULT nextval('comments_id_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: timelife; Owner: postgres
--

ALTER TABLE files ALTER COLUMN id SET DEFAULT nextval('files_id_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: timelife; Owner: postgres
--

ALTER TABLE moments ALTER COLUMN id SET DEFAULT nextval('moments_id_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: timelife; Owner: postgres
--

ALTER TABLE times_lines ALTER COLUMN id SET DEFAULT nextval('times_lines_id_seq'::regclass);


--
-- Name: id; Type: DEFAULT; Schema: timelife; Owner: postgres
--

ALTER TABLE users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);


--
-- Data for Name: comments; Type: TABLE DATA; Schema: timelife; Owner: postgres
--

COPY comments (id, moment_id, title) FROM stdin;
1	20	asdas
2	21	asdasd
\.


--
-- Data for Name: files; Type: TABLE DATA; Schema: timelife; Owner: postgres
--

COPY files (id, name, file, size, ext, moment_id) FROM stdin;
\.


--
-- Data for Name: moments; Type: TABLE DATA; Schema: timelife; Owner: postgres
--

COPY moments (id, time_line_id, create_hour, title, description) FROM stdin;
1	1	2011-11-05 00:12:40-03	asda	Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque orci nunc, placerat eu ullamcorper vel, lacinia at ligula. Nam faucibus vulputate magna vitae fringilla. Ut tincidunt metus sollicitudin leo bibendum eget vulputate velit congue. Vestibulum dignissim scelerisque massa a volutpat. Proin mattis consectetur ligula vel ornare. Ut vestibulum tellus a purus aliquet molestie. Nulla vel urna nec quam sagittis facilisis. Integer a massa metus, at luctus neque. Nulla malesuada fringilla purus, et varius nisl posuere vel. Fusce ut urna lorem.
2	1	2011-11-06 13:59:47-03	asdas	dasdasdasd
\.


--
-- Data for Name: photos; Type: TABLE DATA; Schema: timelife; Owner: postgres
--

COPY photos (id, name, file, size, ext, moment_id) FROM stdin;
1	teste	rodrigoteste	116	jpg	1
\.


--
-- Data for Name: time_lines; Type: TABLE DATA; Schema: timelife; Owner: postgres
--

COPY time_lines (id, user_id, create_date, num_photos) FROM stdin;
1	20	2011-11-05 00:12:12-03	0
2	20	2011-11-09 02:55:08-03	0
\.


--
-- Data for Name: times_lines; Type: TABLE DATA; Schema: timelife; Owner: postgres
--

COPY times_lines (id, user_id, create_date, num_photos) FROM stdin;
1	20	2011-11-05 00:12:12-03	0
\.


--
-- Data for Name: users; Type: TABLE DATA; Schema: timelife; Owner: postgres
--

COPY users (id, name, facebook_id, about, username, "password") FROM stdin;
14	Felipe Gonçalves	100000565638174		\N	90c7c1a03076e632aa4e68ca66073157710f899d
21	\N	100002731314699	\N	\N	b43ef5eaca2012a54ee4bc5a8856e1ba59871bee
22	\N	100000491232219	\N	\N	0c65f74aa07c5a48e6db4409213e884f7895285e
23	\N	100000733414963	\N	\N	5b82929a5889d35a69b0037522977d6f73674779
20	Rodrigo Sanches Devigo	100001625325461	Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque orci nunc, placerat eu ullamcorper vel, lacinia at ligula. Nam faucibus vulputate magna vitae fringilla. 	\N	60a72f8fb823e0828716a92c24b8c68bbae8bbfa
\.


--
-- Name: comments_pkey; Type: CONSTRAINT; Schema: timelife; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY comments
    ADD CONSTRAINT comments_pkey PRIMARY KEY (id);


--
-- Name: photos_pkey; Type: CONSTRAINT; Schema: timelife; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY photos
    ADD CONSTRAINT photos_pkey PRIMARY KEY (id);


--
-- Name: pk_files; Type: CONSTRAINT; Schema: timelife; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY files
    ADD CONSTRAINT pk_files PRIMARY KEY (id);


--
-- Name: pk_moments; Type: CONSTRAINT; Schema: timelife; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY moments
    ADD CONSTRAINT pk_moments PRIMARY KEY (id);


--
-- Name: pk_time_lines; Type: CONSTRAINT; Schema: timelife; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY times_lines
    ADD CONSTRAINT pk_time_lines PRIMARY KEY (id);


--
-- Name: pk_users; Type: CONSTRAINT; Schema: timelife; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY users
    ADD CONSTRAINT pk_users PRIMARY KEY (id);


--
-- Name: time_lines_pkey; Type: CONSTRAINT; Schema: timelife; Owner: postgres; Tablespace: 
--

ALTER TABLE ONLY time_lines
    ADD CONSTRAINT time_lines_pkey PRIMARY KEY (id);


--
-- Name: fdk; Type: FK CONSTRAINT; Schema: timelife; Owner: postgres
--

ALTER TABLE ONLY comments
    ADD CONSTRAINT fdk FOREIGN KEY (moment_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE RESTRICT;


--
-- Name: fk; Type: FK CONSTRAINT; Schema: timelife; Owner: postgres
--

ALTER TABLE ONLY files
    ADD CONSTRAINT fk FOREIGN KEY (moment_id) REFERENCES moments(id) ON UPDATE CASCADE ON DELETE RESTRICT;


--
-- Name: fk_moments_0; Type: FK CONSTRAINT; Schema: timelife; Owner: postgres
--

ALTER TABLE ONLY moments
    ADD CONSTRAINT fk_moments_0 FOREIGN KEY (time_line_id) REFERENCES times_lines(id) ON UPDATE CASCADE ON DELETE RESTRICT;


--
-- Name: fk_time_lines_0; Type: FK CONSTRAINT; Schema: timelife; Owner: postgres
--

ALTER TABLE ONLY times_lines
    ADD CONSTRAINT fk_time_lines_0 FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE RESTRICT;


--
-- Name: photos_moment_id_fkey; Type: FK CONSTRAINT; Schema: timelife; Owner: postgres
--

ALTER TABLE ONLY photos
    ADD CONSTRAINT photos_moment_id_fkey FOREIGN KEY (moment_id) REFERENCES moments(id) ON UPDATE CASCADE ON DELETE RESTRICT;


--
-- Name: time_lines_users_fkey; Type: FK CONSTRAINT; Schema: timelife; Owner: postgres
--

ALTER TABLE ONLY time_lines
    ADD CONSTRAINT time_lines_users_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON UPDATE CASCADE ON DELETE RESTRICT;


--
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--

REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;


--
-- PostgreSQL database dump complete
--

